<?php
namespace Admin\Model;
use Think\Model;
class CategoryModel  extends Model {
     public function getCates(){
          $cates=$this->select();
          $temarr=[];
          foreach ($cates as $v) {
             if ($v['fid']==0){
             	$temarr[]=$v;
             }
          }
          foreach ($temarr as $k=>$row) {
          	 foreach ($cates as $v) {
          	   	if ($v['fid']==$row['id']) {
          	   		$temarr[$k]['son'][]=$v;
          	   	}
          	 }  
          }
         return $temarr;
    }

}